$def with(page)

$ downloadbook = page.get_ia_download_link(".pdf")
$ pdfbw = page.get_ia_download_link("_bw.pdf")
$ epub = page.get_ia_download_link(".epub")
$ mobi = page.get_ia_download_link(".mobi")
$ kindle = "https://www.amazon.com/gp/digital/fiona/web-to-kindle?clientid=IA&itemid=XXX&docid=XXX"
$ djvutxt = page.get_ia_download_link("_djvu.txt")

$if downloadbook or djvutxt or epub or mobi:
  <hr>
  <div class="cta-section">
    <p class="cta-section-title">$_('Download Options')</p>
    <ul class="ebook-download-options">
      $if downloadbook:
        <li><a href="$downloadbook" title="$_('Download a PDF from Internet Archive')">$_('PDF')</a></li>
      $if djvutxt:
        <li><a href="$djvutxt" title="$_('Download a text version from Internet Archive')">$_('Plain text')</a></li>
      $if epub:
        <li><a href="$epub" title="$_('Download an ePub from Internet Archive')">$_('ePub')</a></li>
      $if mobi:
        <li><a href="$mobi" title="$_('Download a MOBI file from Internet Archive')">$_('MOBI')</a></li>
      <li><a href="$page.url('/daisy')" title="$_('Download open DAISY from Internet Archive (print-disabled format)')">$_('DAISY')</a></li>
    </ul>
  </div>
